package com.six.core.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jetbrains.annotations.NotNull;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 首页banner表
 * @TableName tb_banner
 */
@ApiModel(description = "首页banner表")
@TableName(value ="tb_banner")
@Data
public class Banner implements Serializable , Comparable<Banner> {
    /**
     * ID
     */
    @ApiModelProperty("ID")
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;

    /**
     * 标题
     */
    @ApiModelProperty("标题")
    private String title;

    /**
     * 图片地址
     */
    @ApiModelProperty("图片地址")
    private String imageUrl;

    /**
     * 链接地址
     */
    @ApiModelProperty("链接地址")
    private String linkUrl;

    /**
     * 逻辑删除 1（true）已删除， 0（false）未删除
     */
    @ApiModelProperty("逻辑删除 1（true）已删除， 0（false）未删除")
    @TableField(value = "is_deleted",fill = FieldFill.INSERT)//添加时自动填充
    private Integer isDeleted;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    @TableField(value = "gmt_create",fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH-mm-ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @ApiModelProperty("更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH-mm-ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @TableField(value = "gmt_Modified",fill = FieldFill.INSERT_UPDATE)//添加时自动填充
    private Date gmtModified;

    /**
     * 当前的启用状态
     */
    @ApiModelProperty("当前的启用状态")
    @TableField(value = "is_disable",fill = FieldFill.INSERT)//添加时自动填充
    private Integer isDisable;

    @ApiModelProperty("排序")
    private Integer sort;

    @ApiModelProperty(hidden = true)
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;


    @Override
    public int compareTo(@NotNull Banner o) {
        return this.getSort().compareTo(o.getSort());
    }
}